#ifndef UART_H
#define UART_H
#include "stm8l15x.h"
//#include "stdbool.h"
#include "define.h"	

void Debug_printf(char* fmt,...);
void UART1_Init(void);
void UART2_Init(void);
void UART3_Init(void);
void SetTimer1(uint16_t Period, FunctionalState NewState);
void SetTimer2(uint16_t Period, FunctionalState NewState);
void Timer3Init(void);
void Timer4Init(void);
void Timer5Init(void);
void UartSendData(uint8_t *puiBuffer, uint16_t uiLen, USART_TypeDef* USARTx);
void Uart2SendData(uint8_t *puiBuffer, uint16_t uiLen);
void UART1RecvHandle(void);
void UART2RecvHandle(void);
void UART3RecvHandle(void);
uint8_t ReadWriteEquipPara(myUART_TypeDef *UART_Struct, USART_TypeDef* USARTx);
void UART_RcvHandle(void);
unsigned int GetCRC(unsigned char *crc_array,unsigned int start,unsigned int length);
uint8_t GetCRC_8(uint8_t    *ptr, uint8_t len);
int GetChecksum_16(uint8_t    *Src, uint16_t Num);
void RS485SendData(void);
void CollectData(void);
void UartRecvErr(uint8_t *puiBuffer, uint8_t uiCode);
void SaveTenMinuteData(uint8_t suiSeq, uint8_t *Buf, uint8_t uiNum);
//int ArrayParaIndex(uint8_t *uiBuf, uint8_t uiLen, uint8_t uiTarget, uint8_t *puiIndex);
//void SetPara(uint8_t *uiBuf, uint8_t uiNum, myUART_TypeDef *UART_Struct, USART_TypeDef* USARTx);
uint8_t write_data(void);
uint8_t send_data_pack(void);
void time_to_pack(void);




//void USART3_Config(void);
//void uart3_printf(char* fmt,...);




#endif

